let mysql = require('mysql')

class model{
    select(sql, values) {
        return new Promise(function (resolve, reject) {
            let db = mysql.createConnection({
                host: 'localhost',
                user: 'root',
                password: 'root',
                database: 'table',
                port: '3306'
            })
            db.connect();
            db.query(sql, values, function (err, result) {
                if (err) {
                    console.log(reject(err));
                } else {
                    console.log(resolve(result));
                }
            })
            db.end();
        })
    }
}
module.exports = model;